<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="dashboard/header :: header"></head>
<body>
	<div layout:fragment="content">
		<div class="container-fluid content-main">
			<div class="animated fadeIn">
				<div class="row">
					<!-- /.col-->
					<div class="col-sm-12">
						<div class="card">
							<div class="card-body">

								<form class="form-horizontal" id="addForm">

									<input type="hidden" name="formToken"
										th:value="${session.formToken}" />

									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="text-input">应用名称</label>
										<div class="col-md-9">
											<input class="form-control" id="applicationName" type="text"
												name="applicationName" placeholder="应用名称">
										</div>
									</div>

									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">数据库连接</label>
										<div class="col-md-9">
											<input class="form-control" id="dbUrl" type="text"
												placeholder="例如:jdbc:mysql://localhost:3306/alinesno_cloud_base_storage"
												name="dbUrl">
										</div>
									</div>

									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">数据库账号</label>
										<div class="col-md-9">
											<div class="row">
												<div class="col-md-5">
													<input type="text" class="form-control" id="dbUser" name="dbUser"
														placeholder="数据库用户">
												</div>
												<div class="col-md-5">
													<input type="text" class="form-control" id="dbPwd" name="dbPwd"
														placeholder="数据库密码">
												</div>
											</div>
										</div>
									</div>

									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">作者名称</label>
										<div class="col-md-9">
											<input class="form-control" id="authorName" type="text" name="authorName" placeholder="作者名称">
										</div>
									</div>
	
									<div class="hr-line-dashed"></div>

									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">工程名</label>
										<div class="col-md-9">
											<input class="form-control" type="hidden" value="com.alinesno.cloud" name="packageName" placeholder="包名" >
											<input class="form-control" id="feignServerPath" type="text" name="feignServerPath" placeholder="如: alinesno-cloud-base-boot">
										</div>
									</div>
										
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">git仓库地址</label>
										<div class="col-md-9">
											<input class="form-control" id="gitRepositoryUrl" type="text"
												placeholder="https://gitee.com/xxx/xxx" name="gitRepositoryUrl" >
										</div>
									</div>
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">git账号</label>
										<div class="col-md-9">
											<div class="row">
												<div class="col-md-5">
													<input type="text" class="form-control" id="gitUserName" name="gitUserName"
														placeholder="git用户名">
												</div>
												<div class="col-md-5">
													<input type="text" class="form-control" id="gitPassword" name="gitPassword"
														placeholder="git密码">
												</div>
											</div>
										</div>
									</div>
									
									<div class="form-group row">
										<label class="col-md-2 col-form-label control-label" for="email-input">应用类型</label>
										<div class="col-md-9">
											<div class="checkbox">
												<label> 
													<input type="checkbox" name="serviceProject" readonly="readonly" onclick="return false"> 服务化 
													<span style="color:gray;margin-left:10px;"> (生成分布式服务工程代码)</span>
												</label>
											</div>
											<div class="checkbox">
												<label> 
													<input type="checkbox" name="dockerProject" checked="checked" readonly="readonly" onclick="return false"> 配置容器 
													<span style="color:gray;margin-left:10px;"> (此功能将生成容器地址并返回)</span>
												</label>
											</div>
										</div>
									</div>

								</form>

							</div>
						</div>
					</div>
					<!-- /.col-->
				</div>
			</div>
		</div>

	</div>

	<footer th:replace="dashboard/footer :: footer"></footer>

	<script type="text/javascript">
	
		var addForm = $("#addForm") ; 
		$(function(){
			var icon = "<i class='fa fa-times-circle'></i> ";
			addForm.validate({
				ignore: [],  
				rules: {
					applicationName: "required",
					applicationDesc: "required",
					applicationIcons: "required" , 
					dbUrl: "required"  , 
					dbUser: "required" ,
					dbPwd: "required"  , 
					feignServerPath: "required"  , 
					gitRepositoryUrl: {required:true , url:true} ,
					gitUserName: "required"  , 
					authorName : "required"  , 
					gitPassword: "required"  
				}
			});
		}) ;
		
		// 保存操作
		function submitHandler() {
			var result = $.validate.form("addForm");
			if(result){
				$.operate.save(ctx + "portal/ucenter/source/save",$('#addForm').serialize());
			}
		}
	</script>

</body>
</html>
